﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data ;
using System.Windows.Forms;
using libDAL;

namespace libInventory.BUS
{
    public class clsInterfaceSalesTerm : IDisposable 
    {
        private clsBUSSalesTerm _BUS;

        public clsInterfaceSalesTerm()
        {
            _BUS = new clsBUSSalesTerm();
        }

        public string get_ChargeDescription(string strChargeID)
        {
            return _BUS.get_ChargeDescription(strChargeID); 
        }
        public void set_OriginCharges(string strChargesDetailsID)
        {
            _BUS.set_OriginCharges(strChargesDetailsID);
        }
        public void set_DestinationCharges(string strChargesDetailsID)
        {
            _BUS.set_DestinationCharges(strChargesDetailsID);
        }

        public cls_DAL get_DAL
        {
            get
            {
                return _BUS.get_DAL;
            }
        }

        public DataTable get_Charges()
        {
            return _BUS.get_Charges(); 
        }

        public DataTable get_Ports()
        {
            return _BUS.get_Ports();
        }

        public bool get_checkNewRowSetup()
        {
                return _BUS.get_checkNewRowSetup(); 
        }

        public bool get_SetNewRowDetailsCharges()
        {
            return _BUS.get_SetNewRowDetailsCharges();
        }

        public bool get_SetNewRowHeaderCharges()
        {
            return _BUS.get_SetNewRowHeaderCharges(); 
        }

        public DataRow getset_NewRowHeaderCharges
        {
            get
            {
                return _BUS.getset_NewRowHeaderCharge; 
            }
            set
            {
                _BUS.getset_NewRowHeaderCharge = value;
            }
        }

        public DataRow getset_NewRowDetailsCharge
        {
            get
            {
               return _BUS.getset_NewRowDetailsCharge;
            }
            set
            {
                _BUS.getset_NewRowDetailsCharge = value;
            }
        }

        public bool get_OriginDestinationLoaded
        {
            get
            {
                return _BUS.get_OriginDestinationLoaded;
            }
        }

        public bool get_CheckDetailsIDExists(string strDetailsID, bool bolOriginDestination)
        {
            return _BUS.get_CheckDetailsIDExists(strDetailsID, bolOriginDestination);  
        }

        public bool get_CheckAdditionalChargesIDExists(string strDetailsID, bool bolOriginDestination)
        {
            return _BUS.get_CheckAdditionalChargesIDExists(strDetailsID, bolOriginDestination);
        }

        public DataRow[] get_AdditionalChargesDestination
        {
            get
            {
                return _BUS.get_AdditionalChargesDestination;
            }
            set
            {
                _BUS.get_AdditionalChargesDestination = value;
            }
        }

        public DataRow[] get_AdditionalChargesOrigin
        {
            get
            {
                return _BUS.get_AdditionalChargesOrigin;
            }
            set
            {
                _BUS.get_AdditionalChargesOrigin = value;
            }
        }

        public bool set_RecordsOriginDestination(string strHeaderID)
        {
          return _BUS.set_RecordsOriginDestination(strHeaderID);
        }
        
        public DataRow[] get_DestinationCharges
        {
            get
            {
                return _BUS.get_DestinationCharges;
            }
        }
        
        public DataRow[] get_OrginCharges
        {
            get
            {
                return _BUS.get_OriginCharges; 
            }
        }

        public DataRow[] getset_HeaderInfo
        {
            get
            {
                return _BUS.getset_HeaderInfo;
            }
            set
            {
                _BUS.getset_HeaderInfo = value;
            }
        }

        public DataTable get_SalesTermsHeader(string strIncoterm, string strType, string strCategory, 
                                                     string strOrgin, string strDestination, DateTime dteFrom, 
                                                     DateTime dteTo)
        {
            DataTable dtResult = new DataTable();
            try
            {
                dtResult =  _BUS.get_ChargesHeader(strIncoterm, strType, strCategory, strOrgin, strDestination, dteFrom, dteTo);   
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.InnerException.Message + " get_SalesTermsHeader");
            }

            return dtResult;
        }

        internal bool set_AddDataRowOriginDestination()
        {
            return _BUS.set_AddDataRowOriginDestination();
        }
        public DataTable getset_Charges
        {
            get
            {
                return _BUS.getset_Charges;
            }
            set
            {
                _BUS.getset_Charges = value;
            }
        }

        public bool set_HeaderInfo(string strHeaderID)
        {
            return _BUS.set_HeaderInfo(strHeaderID);
        }

        public bool set_AddDataHeader()
        {
            return _BUS.set_AddDataHeader(); 
        }

        public bool get_CheckHeaderExists(string strHeaderID)
        {
            return _BUS.get_CheckHeaderExists(strHeaderID); 
        }

        public bool set_CommitRecordsHeader()
        {
            return _BUS.set_CommitRecordsHeader(); 
        }

        public bool set_AddUpdateAdditionalChargesOriginDestination(DataTable dtOriginDestination)
        {
            return _BUS.set_AddUpdateAdditionalChargesOriginDestination(dtOriginDestination); 
        }

        public bool set_AddUpdateOriginDestination(DataTable dtOriginDestination)
        {
            bool bolStatus = false;
            try
            {
               return _BUS.set_AddUpdateOriginDestination(dtOriginDestination);  
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " set_AddUpdateOriginDestination");  
            }
            return bolStatus;
        
        }
        public bool set_CommitRecordsAdditionalCharges()
        {
            return _BUS.set_CommitRecordsAdditionalCharges(); 
        }

        internal bool set_UpdateRecordsDetails()
        {
            return _BUS.set_CommitRecordsDetails();
        }

        public void Dispose()
        {
            _BUS.Dispose();
            GC.Collect();
            //throw new NotImplementedException();
        }
    }
}
